Skip to content

Fix how we build frameworks. Fixes #53813. (#1952) - #1985

Merged
spouliot merged 1 commit into
dotnet:d15-2from
rolfbjarne:framework-bitcode-fix-d15-2
Apr 11, 2017
Merged

Fix how we build frameworks. Fixes #53813. (#1952)#1985
spouliot merged 1 commit into
dotnet:d15-2from
rolfbjarne:framework-bitcode-fix-d15-2

Conversation

@rolfbjarne

Copy link
Copy Markdown
Member

Previously we copied any equivalent .dylib and ran install_name_tool on the
library to change the library id to make it a framework.

Unfortunately this does not work when the library contains bitcode, because
bitcode embeds linker flags (-install_name for instance), and
install_name_tool does not change those linker flags.

This means that we need to create frameworks by linking with the proper
arguments, since it's much more difficult to fixup the embedded bitcode linker
flags as well.

So change how be build Mono.framework, Xamarin.framework, and any frameworks
built from assemblies to:

  • Always link instead of fixup a dylib. For Mono.framework this means
    extracting all the object files from libmonosgen-2.0.a and linking those,
    for Xamarin.framework this means linking the object files we've already
    built.

  • Make sure the library is correctly named when linked (once again: bitcode
    contains embedded linker flags, so renaming the executable later breaks
    stuff as well).

I've also extracted the logic that creates Mono.framework from
libmonosgen-2.0.a to a separate shell script, to deduplicate this logic.

This required a minor change in the mono builds: we need the Mono.framework
when building the all target, so make sure that happens.

https://bugzilla.xamarin.com/show_bug.cgi?id=53813

Previously we copied any equivalent .dylib and ran install_name_tool on the
library to change the library id to make it a framework.

Unfortunately this does not work when the library contains bitcode, because
bitcode embeds linker flags (-install_name for instance), and
install_name_tool does not change those linker flags.

This means that we need to create frameworks by linking with the proper
arguments, since it's much more difficult to fixup the embedded bitcode linker
flags as well.

So change how be build Mono.framework, Xamarin.framework, and any frameworks
built from assemblies to:

* Always link instead of fixup a dylib. For Mono.framework this means
  extracting all the object files from libmonosgen-2.0.a and linking those,
  for Xamarin.framework this means linking the object files we've already
  built.

* Make sure the library is correctly named when linked (once again: bitcode
  contains embedded linker flags, so renaming the executable later breaks
  stuff as well).

I've also extracted the logic that creates Mono.framework from
libmonosgen-2.0.a to a separate shell script, to deduplicate this logic.

This required a minor change in the mono builds: we need the Mono.framework
when building the `all` target, so make sure that happens.

https://bugzilla.xamarin.com/show_bug.cgi?id=53813
@rolfbjarne

Copy link
Copy Markdown
Member Author

This is a backport of PR #1985.

@rolfbjarne rolfbjarne added this to the d15-2 milestone Apr 11, 2017
@monojenkins

Copy link
Copy Markdown
Contributor

Build success

@spouliot
spouliot merged commit 72f6801 into dotnet:d15-2 Apr 11, 2017
VincentDondain added a commit to VincentDondain/xamarin-macios that referenced this pull request Sep 18, 2019
New commits in xamarin/maccore:

* xamarin/maccore@486ad67875 [device-builds] Fix if condition typo (double `[`) (dotnet#1985)
* xamarin/maccore@fda32707a7 [tests] Update (and hopefully simplify)  submission tests documentation wrt cerficates/profiles expiration (dotnet#1972)
* xamarin/maccore@f23cd3a194 Merge pull request dotnet#1977 from xamarin/swift-o-matic-protocol-list-enum-factory
* xamarin/maccore@aaa2bec8da Enum factory test
* xamarin/maccore@d3c7890df2 Merge pull request dotnet#1974 from xamarin/swift-o-matic-protocol-list-enum
* xamarin/maccore@436a376ab4 [provisioning-profiles] Add 'Developer ID Application' and 'Developer ID Installer' certificates. (dotnet#1975)
* xamarin/maccore@ddc68fc899 Support for protocol list types in enum payloads.

Diff: https://github.com/xamarin/maccore/compare/4611683312fd8ad4eb2b2c093e43a5f71405bdee..486ad67875db90261f3c9818380b979db3094946
VincentDondain added a commit that referenced this pull request Sep 19, 2019
New commits in xamarin/maccore:

* xamarin/maccore@486ad67875 [device-builds] Fix if condition typo (double `[`) (#1985)
* xamarin/maccore@fda32707a7 [tests] Update (and hopefully simplify)  submission tests documentation wrt cerficates/profiles expiration (#1972)
* xamarin/maccore@f23cd3a194 Merge pull request #1977 from xamarin/swift-o-matic-protocol-list-enum-factory
* xamarin/maccore@aaa2bec8da Enum factory test
* xamarin/maccore@d3c7890df2 Merge pull request #1974 from xamarin/swift-o-matic-protocol-list-enum
* xamarin/maccore@436a376ab4 [provisioning-profiles] Add 'Developer ID Application' and 'Developer ID Installer' certificates. (#1975)
* xamarin/maccore@ddc68fc899 Support for protocol list types in enum payloads.

Diff: https://github.com/xamarin/maccore/compare/4611683312fd8ad4eb2b2c093e43a5f71405bdee..486ad67875db90261f3c9818380b979db3094946
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants